package com.yz.lzq.liwushuo.ui.modules.category.gongl;

import android.content.Context;
import android.util.Log;

import com.yz.lzq.liwushuo.jsonbean.category.CategoryBean;

import java.util.List;

/**
 * Created by AdminJia on 2016/11/30.
 */

public class CategoryGongLPresenter {
    private ICategoryGongLBiz iCategoryGongLBiz;
    private ICategoryGongLView iCategoryGongLView;

    public CategoryGongLPresenter(ICategoryGongLView iCategoryGongLView) {
        this.iCategoryGongLBiz = new CategoryGongLBiz();
        this.iCategoryGongLView = iCategoryGongLView;
    }

    public void getData(final Context mContent) {
        iCategoryGongLBiz.getDataSuccess(new OnCategoryGongListener() {
            @Override
            public void getDataSuccess(List<CategoryBean.CategoryGongLBean.DataBean.ChannelGroupsBean>
                                               list_gongL) {
                CategorygongLAdapter adapter = new CategorygongLAdapter(mContent, list_gongL);
                iCategoryGongLView.setAdapterSuccess(adapter);
                Log.i("TAG", "=======getDataSuccess: " + list_gongL.size());
            }

            @Override
            public void getDataFailed(Throwable t) {

            }
        });
    }

    public void getHeaderData(final Context mContent) {
        iCategoryGongLBiz.getHeaderDataSuccess(new OnCategoryGongHeaderListener() {
            @Override
            public void getHeaderDataSuccess(List<CategoryBean.CategoryGongLHeaderBean.DataBean.ColumnsBean>
                                                     columns) {
                CategoryGongLHeaderAdapter adapter = new CategoryGongLHeaderAdapter(columns,
                        mContent);
                Log.i("TAG", "==========getHeaderDataSuccess: " + columns.size());
                iCategoryGongLView.setHeaderAdapter(adapter);
            }

            @Override
            public void getDataFailed(Throwable t) {

            }
        });
    }

}
